<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
<form action="upload_file.php" method="post"enctype="multipart/form-data">
  <label for="file">Chọn một tập tin ảnh.</label>
  <input type="file" name="file" id="file" />
  <br />
  <input type="submit" name="submit" value="tải ảnh" />
</form>
<?php 
$sql="SELECT id, path FROM photos WHERE user_id=".$_COOKIE["user_id"];
$result=mysql_query($sql);
$rows=mysql_num_rows($result);
$u=$rows/4+1;
echo "<table>";
while($u)
{
	echo "<tr>";
	$i=4;
	while($i)
	{
		echo "<td>";
		$row = mysql_fetch_array($result);
		echo "<a href=\"viewPhoto.php?id=".$row["id"]."\"><img src=\"".$row["path"]."\" width=\"180\" height=\"120\" /></a>";
		echo "</td>";
		$i--;
	}
	echo "</tr>";
	$u--;
}
echo "</table>";
?>
</body>
</html>